from model.dbmodel import DbParkRecord, DbTask, DbTaskRecord
from model.result import Result

def result2dbmodel(task: DbTask, result: Result):
    model = DbParkRecord()
    model.car_number = str(result.car_number)
    model.task_id = task.id
    model.platform_id = result.platform.id
    model.user_id = task.user_id
    model.park_name = result.park_name
    model.entry_time = result.enter_time
    model.parking_often = result.stay_time_str()
    model.parking_fees = result.price_str()
    return model
